package unit07;

import java.util.*;

public class Demo01 {
    public static void main(String args[]) {
        Scanner reader = new Scanner(System.in);
        List<Double> numbers = new ArrayList<>();

        while (reader.hasNextDouble()) {
            double x = reader.nextDouble();
            assert x <= 100 && x >= 0 : "数据不合理";
            numbers.add(x);
        }

        int count = numbers.size();
        double sum = numbers.stream().mapToDouble(Double::doubleValue).sum();
        double average = sum / count;

        System.out.printf("%d个数的和为%f\n", count, sum);
        System.out.printf("%d个数的平均值是%f\n", count, average);
    }
}